package com.glsc.ngateway.common.base.converter.platform;

import com.alibaba.excel.util.CollectionUtils;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.flow.FlowFormEquipmentModifyCloudDeviceDetail;
import com.glsc.ngateway.common.base.domainmapper.FlowFormEquipmentModifyCloudDeviceDetailMapper;
import com.glsc.ngateway.common.api.flowable.dto.task.formData.equipment.domainDto.FlowFormEquipmentModifyCloudDeviceDetailDto;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * FlowFormEquipmentModifyCloudDeviceDetail转换器
 * @author xuchang
 */
public class FlowFormEquipmentModifyCloudDeviceDetailConverter extends AbstractFlowFormDataConverter {
    public static FlowFormEquipmentModifyCloudDeviceDetailDto do2Dto(FlowFormEquipmentModifyCloudDeviceDetail modifyCloudDevice) {
        if (Objects.isNull(modifyCloudDevice)) {
            return null;
        }
        return FlowFormEquipmentModifyCloudDeviceDetailMapper.INSTANCE.domain2dto(modifyCloudDevice);
    }

    public static List<FlowFormEquipmentModifyCloudDeviceDetailDto> do2Dto(List<FlowFormEquipmentModifyCloudDeviceDetail> modifyCloudDeviceList) {
        return CollectionUtils.isEmpty(modifyCloudDeviceList) ? java.util.Collections.emptyList() : modifyCloudDeviceList.stream().map(FlowFormEquipmentModifyCloudDeviceDetailConverter::do2Dto).collect(Collectors.toList());
    }

    public static FlowFormEquipmentModifyCloudDeviceDetail dto2Do(FlowFormEquipmentModifyCloudDeviceDetailDto modifyCloudDeviceDto) {
        if (Objects.isNull(modifyCloudDeviceDto)) {
            return null;
        }
        return FlowFormEquipmentModifyCloudDeviceDetailMapper.INSTANCE.dto2domain(modifyCloudDeviceDto);
    }

    public static List<FlowFormEquipmentModifyCloudDeviceDetail> dto2Do(List<FlowFormEquipmentModifyCloudDeviceDetailDto> modifyCloudDeviceDtoList) {
        return CollectionUtils.isEmpty(modifyCloudDeviceDtoList) ? java.util.Collections.emptyList() : modifyCloudDeviceDtoList.stream().map(FlowFormEquipmentModifyCloudDeviceDetailConverter::dto2Do).collect(Collectors.toList());
    }


}
